package com.mdms.interfaces.orm;

import java.util.List;

import org.hibernate.Transaction;


public interface CrudDAO {

void setPersistentClass(Class persistentClass);
    
    Object findById(Long id);
    
    Object findForUpdateById(Long id);
    
	Object find(Object entity, boolean checkAuditMD);
	
	Object findAndLock(Object entity);
	
	Object findAndLock(Object entity,String usrId);
	
	Object unLock(Object entity);
	
	void unLockById(Long id);

	List findAll();

	List findByExample(Object exampleInstance, List excludeProperties);
	
	List findByCriterions(List criterions, int firstResult, int pageSize, String order, boolean asc);
	
	List findByCriterions(List criterions, int firstResult, int pageSize);
	
	List findByCriterions(List criterions);
	
	List findByCriteria(Object criteria);
	
	List findByCriteria(Object criteria, int firstResult, int pageSize);
	
	List findByCriteriaDistinct(Object criteria, int firstResult, int pageSize);
	
	int getResultSetSize(List criterions);
	
	int getResultSetSize(Object criteria);
	
	int getDistinctResultSetSize(Object criteria);

	Object makePersistent(Object entity) throws Exception;
	
	Object merge(Object entity) throws Exception;
	
	Object merge(Object entity, boolean hasAuditDates) throws Exception;
	
	Object merge(Object entity, boolean hasAuditDates, boolean hasPkLongType) throws Exception;

	void makeTransient(Object entity);
	
	boolean checkAuditDate(Object entity);
	
	public Transaction beginTransaction();

	/**
	 * Affects every managed instance in the current persistence context!
	 */
	void flush();

	/**
	 * Affects every managed instance in the current persistence context!
	 */
	void clear();
}
